package apIExercise.object;

import java.util.Scanner;

public class Matches {
    public static void main(String[] args) {
//        String email = "wangkj@tedu.cn";
//        String regex = "[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
//        boolean match = email.matches(regex);
//        System.out.println(match);
//        if(match){
//            System.out.println("邮箱正确");
//        }else{
//            System.out.println("邮箱不正确");
//        }

        //String email1="www.baidu.com";
        //String regex1="[a-zA-Z0-9_]+(\\.)[a-zA-Z0-9_]+(\\.)[a-zA-Z0-9_]+";
        //boolean match1=email1.matches(regex1);
        //System.out.println(match1);
        String regex1="[a-zA-Z0-9_]+(\\.)[a-zA-Z0-9_]+(\\.)[a-zA-Z0-9_]+";
        Scanner scan=new Scanner(System.in);
        for(int i=0;i<=5;i++){
            System.out.println("请输入网站：");
            String email1=scan.next();
            System.out.println(email1);
            boolean match=email1.matches(regex1);
            if(match){
                System.out.println("网址输入正确");
            }else{
                System.out.println("网址输入不正确");
            }

        }

    }
}
